package com.jcfy.project.module.service.impl;

import java.util.List;
import com.jcfy.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jcfy.project.module.mapper.TOrderGoodsMapper;
import com.jcfy.project.module.domain.TOrderGoods;
import com.jcfy.project.module.service.ITOrderGoodsService;

/**
 * 订单商品Service业务层处理
 *
 * @author jiangfeng
 * @date 2020-08-05
 */
@Service
public class TOrderGoodsServiceImpl implements ITOrderGoodsService {
    @Autowired
    private TOrderGoodsMapper tOrderGoodsMapper;

    /**
     * 查询订单商品
     *
     * @param orderGoodsId 订单商品ID
     * @return 订单商品
     */
    @Override
    public TOrderGoods selectTOrderGoodsById(Long orderGoodsId) {
        return tOrderGoodsMapper.selectTOrderGoodsById(orderGoodsId);
    }

    /**
     * 查询订单商品列表
     *
     * @param tOrderGoods 订单商品
     * @return 订单商品
     */
    @Override
    public List<TOrderGoods> selectTOrderGoodsList(TOrderGoods tOrderGoods) {
        return tOrderGoodsMapper.selectTOrderGoodsList(tOrderGoods);
    }

    /**
     * 新增订单商品
     *
     * @param tOrderGoods 订单商品
     * @return 结果
     */
    @Override
    public int insertTOrderGoods(TOrderGoods tOrderGoods) {
        tOrderGoods.setCreateTime(DateUtils.getNowDate());
        return tOrderGoodsMapper.insertTOrderGoods(tOrderGoods);
    }

    /**
     * 修改订单商品
     *
     * @param tOrderGoods 订单商品
     * @return 结果
     */
    @Override
    public int updateTOrderGoods(TOrderGoods tOrderGoods) {
        tOrderGoods.setUpdateTime(DateUtils.getNowDate());
        return tOrderGoodsMapper.updateTOrderGoods(tOrderGoods);
    }

    /**
     * 批量删除订单商品
     *
     * @param orderGoodsIds 需要删除的订单商品ID
     * @return 结果
     */
    @Override
    public int deleteTOrderGoodsByIds(Long[] orderGoodsIds) {
        return tOrderGoodsMapper.deleteTOrderGoodsByIds(orderGoodsIds);
    }

    /**
     * 删除订单商品信息
     *
     * @param orderGoodsId 订单商品ID
     * @return 结果
     */
    @Override
    public int deleteTOrderGoodsById(Long orderGoodsId) {
        return tOrderGoodsMapper.deleteTOrderGoodsById(orderGoodsId);
    }
}
